/*
 * @Author: mayufo
 * @Date: 2020-02-14 13:47:16
 * @LastEditTime : 2020-02-14 14:12:17
 * @Description: 入口
 * @FilePath: /node/04/code/crud-express/app.js
 */
var express = require('express')
var bodyParser = require('body-parser')
var router = require('./router')

var app = express()

// 配置body-parser
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
// 配置静态资源
app.use('/node_modules', express.static('node_modules'));
app.use('/public', express.static('public'));

// 配置template
app.engine('html', require('express-art-template'));

app.use(router)

app.listen(3000, function () {
    console.log('listening on port 3000!')
})

exports.module = app